package com.itqf.entity;

import java.io.Serializable;
import java.math.BigDecimal;

public class Car implements Serializable {
    private static final long serialVersionUID =1L;
    private  int cid;
    private int userno;
    private int gid;
    private Goods goods;
    private int number = 0;
    private BigDecimal count;
    public Goods getGoods() {
        return goods;
    }

    public Car(int cid, int userno, int gid, Goods goods, int number, BigDecimal count) {
        this.cid = cid;
        this.userno = userno;
        this.gid = gid;
        this.goods = goods;
        this.number = number;
        this.count = count;
    }

    public Car() {
    }

    public void setGoods(Goods goods) {
        this.goods = goods;
    }
    public int getCid() {
        return cid;
    }

    public void setCid(int cid) {
        this.cid = cid;
    }

    public int getUserno() {
        return userno;
    }

    public void setUserno(int userno) {
        this.userno = userno;
    }

    public int getGid() {
        return gid;
    }

    public void setGid(int gid) {
        this.gid = gid;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public BigDecimal getCount() {
        BigDecimal gprice = goods.getGprice();
        BigDecimal bigDecimal = new BigDecimal(number);
        return gprice.multiply(bigDecimal);
    }

    public void setCount(BigDecimal count) {
        this.count = count;
    }

    @Override
    public String toString() {
        return "Car{" +
                "cid=" + cid +
                ", userno='" + userno + '\'' +
                ", gid=" + gid +
                ", number=" + number +
                ", count=" + count +
                '}';
    }
}
